//
//  InsetsLabel.m
//  Pad-test
//
//  Created by jayce on 17/3/24.
//  Copyright © 2017年 jjkj. All rights reserved.
//

#import "InsetsLabel.h"

@implementation InsetsLabel

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        self.textColor = [UIColor darkGrayColor];
        self.font = [UIFont systemFontOfSize:16];
        self.layer.borderColor = [UIColor lightGrayColor].CGColor;
        self.layer.borderWidth = 1.0f;
        self.textAlignment = NSTextAlignmentCenter;
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame andInsets:(UIEdgeInsets)aInsets{
    
    self = [super initWithFrame:frame];
    if (self) {
        self.insets = aInsets;
        self.textColor = [UIColor darkGrayColor];
        self.font = [UIFont systemFontOfSize:16];
        self.layer.borderColor = [UIColor lightGrayColor].CGColor;
        self.layer.borderWidth = 1.0f;
    }
    return self;
}

-(void)drawTextInRect:(CGRect)rect{
    
    UIEdgeInsets insets = {0, 10, 0, 0};
    return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
}


@end
